(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
natsFrom(N) → cons(N, n__natsFrom(s(N)))
fst(pair(XS, YS)) → XS
snd(pair(XS, YS)) → YS
splitAt(0, XS) → pair(nil, XS)
splitAt(s(N), cons(X, XS)) → u(splitAt(N, activate(XS)), N, X, activate(XS))
u(pair(YS, ZS), N, X, XS) → pair(cons(activate(X), YS), ZS)
head(cons(N, XS)) → N
tail(cons(N, XS)) → activate(XS)
sel(N, XS) → head(afterNth(N, XS))
take(N, XS) → fst(splitAt(N, XS))
afterNth(N, XS) → snd(splitAt(N, XS))
natsFrom(X) → n__natsFrom(X)
activate(n__natsFrom(X)) → natsFrom(X)
activate(X) → X
Rewrite Strategy: INNERMOST
(1) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)
Converted CpxTRS to CDT
(2) Obligation:
Complexity Dependency Tuples Problem
Rules:
natsFrom(z0) → cons(z0, n__natsFrom(s(z0)))
natsFrom(z0) → n__natsFrom(z0)
fst(pair(z0, z1)) → z0
snd(pair(z0, z1)) → z1
splitAt(0, z0) → pair(nil, z0)
splitAt(s(z0), cons(z1, z2)) → u(splitAt(z0, activate(z2)), z0, z1, activate(z2))
u(pair(z0, z1), z2, z3, z4) → pair(cons(activate(z3), z0), z1)
head(cons(z0, z1)) → z0
tail(cons(z0, z1)) → activate(z1)
sel(z0, z1) → head(afterNth(z0, z1))
take(z0, z1) → fst(splitAt(z0, z1))
afterNth(z0, z1) → snd(splitAt(z0, z1))
activate(n__natsFrom(z0)) → natsFrom(z0)
activate(z0) → z0
Tuples:
SPLITAT(s(z0), cons(z1, z2)) → c5(U(splitAt(z0, activate(z2)), z0, z1, activate(z2)), SPLITAT(z0, activate(z2)), ACTIVATE(z2), ACTIVATE(z2))
U(pair(z0, z1), z2, z3, z4) → c6(ACTIVATE(z3))
TAIL(cons(z0, z1)) → c8(ACTIVATE(z1))
SEL(z0, z1) → c9(HEAD(afterNth(z0, z1)), AFTERNTH(z0, z1))
TAKE(z0, z1) → c10(FST(splitAt(z0, z1)), SPLITAT(z0, z1))
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
ACTIVATE(n__natsFrom(z0)) → c12(NATSFROM(z0))
S tuples:
SPLITAT(s(z0), cons(z1, z2)) → c5(U(splitAt(z0, activate(z2)), z0, z1, activate(z2)), SPLITAT(z0, activate(z2)), ACTIVATE(z2), ACTIVATE(z2))
U(pair(z0, z1), z2, z3, z4) → c6(ACTIVATE(z3))
TAIL(cons(z0, z1)) → c8(ACTIVATE(z1))
SEL(z0, z1) → c9(HEAD(afterNth(z0, z1)), AFTERNTH(z0, z1))
TAKE(z0, z1) → c10(FST(splitAt(z0, z1)), SPLITAT(z0, z1))
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
ACTIVATE(n__natsFrom(z0)) → c12(NATSFROM(z0))
K tuples:none
Defined Rule Symbols:
natsFrom, fst, snd, splitAt, u, head, tail, sel, take, afterNth, activate
Defined Pair Symbols:
SPLITAT, U, TAIL, SEL, TAKE, AFTERNTH, ACTIVATE
Compound Symbols:
c5, c6, c8, c9, c10, c11, c12
(3) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)
Removed 3 trailing nodes:
ACTIVATE(n__natsFrom(z0)) → c12(NATSFROM(z0))
TAIL(cons(z0, z1)) → c8(ACTIVATE(z1))
U(pair(z0, z1), z2, z3, z4) → c6(ACTIVATE(z3))
(4) Obligation:
Complexity Dependency Tuples Problem
Rules:
natsFrom(z0) → cons(z0, n__natsFrom(s(z0)))
natsFrom(z0) → n__natsFrom(z0)
fst(pair(z0, z1)) → z0
snd(pair(z0, z1)) → z1
splitAt(0, z0) → pair(nil, z0)
splitAt(s(z0), cons(z1, z2)) → u(splitAt(z0, activate(z2)), z0, z1, activate(z2))
u(pair(z0, z1), z2, z3, z4) → pair(cons(activate(z3), z0), z1)
head(cons(z0, z1)) → z0
tail(cons(z0, z1)) → activate(z1)
sel(z0, z1) → head(afterNth(z0, z1))
take(z0, z1) → fst(splitAt(z0, z1))
afterNth(z0, z1) → snd(splitAt(z0, z1))
activate(n__natsFrom(z0)) → natsFrom(z0)
activate(z0) → z0
Tuples:
SPLITAT(s(z0), cons(z1, z2)) → c5(U(splitAt(z0, activate(z2)), z0, z1, activate(z2)), SPLITAT(z0, activate(z2)), ACTIVATE(z2), ACTIVATE(z2))
SEL(z0, z1) → c9(HEAD(afterNth(z0, z1)), AFTERNTH(z0, z1))
TAKE(z0, z1) → c10(FST(splitAt(z0, z1)), SPLITAT(z0, z1))
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
S tuples:
SPLITAT(s(z0), cons(z1, z2)) → c5(U(splitAt(z0, activate(z2)), z0, z1, activate(z2)), SPLITAT(z0, activate(z2)), ACTIVATE(z2), ACTIVATE(z2))
SEL(z0, z1) → c9(HEAD(afterNth(z0, z1)), AFTERNTH(z0, z1))
TAKE(z0, z1) → c10(FST(splitAt(z0, z1)), SPLITAT(z0, z1))
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
K tuples:none
Defined Rule Symbols:
natsFrom, fst, snd, splitAt, u, head, tail, sel, take, afterNth, activate
Defined Pair Symbols:
SPLITAT, SEL, TAKE, AFTERNTH
Compound Symbols:
c5, c9, c10, c11
(5) CdtKnowledgeProof (EQUIVALENT transformation)
The following tuples could be moved from S to K by knowledge propagation:
SEL(z0, z1) → c9(HEAD(afterNth(z0, z1)), AFTERNTH(z0, z1))
TAKE(z0, z1) → c10(FST(splitAt(z0, z1)), SPLITAT(z0, z1))
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
(6) Obligation:
Complexity Dependency Tuples Problem
Rules:
natsFrom(z0) → cons(z0, n__natsFrom(s(z0)))
natsFrom(z0) → n__natsFrom(z0)
fst(pair(z0, z1)) → z0
snd(pair(z0, z1)) → z1
splitAt(0, z0) → pair(nil, z0)
splitAt(s(z0), cons(z1, z2)) → u(splitAt(z0, activate(z2)), z0, z1, activate(z2))
u(pair(z0, z1), z2, z3, z4) → pair(cons(activate(z3), z0), z1)
head(cons(z0, z1)) → z0
tail(cons(z0, z1)) → activate(z1)
sel(z0, z1) → head(afterNth(z0, z1))
take(z0, z1) → fst(splitAt(z0, z1))
afterNth(z0, z1) → snd(splitAt(z0, z1))
activate(n__natsFrom(z0)) → natsFrom(z0)
activate(z0) → z0
Tuples:
SPLITAT(s(z0), cons(z1, z2)) → c5(U(splitAt(z0, activate(z2)), z0, z1, activate(z2)), SPLITAT(z0, activate(z2)), ACTIVATE(z2), ACTIVATE(z2))
SEL(z0, z1) → c9(HEAD(afterNth(z0, z1)), AFTERNTH(z0, z1))
TAKE(z0, z1) → c10(FST(splitAt(z0, z1)), SPLITAT(z0, z1))
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
S tuples:
SPLITAT(s(z0), cons(z1, z2)) → c5(U(splitAt(z0, activate(z2)), z0, z1, activate(z2)), SPLITAT(z0, activate(z2)), ACTIVATE(z2), ACTIVATE(z2))
K tuples:
SEL(z0, z1) → c9(HEAD(afterNth(z0, z1)), AFTERNTH(z0, z1))
TAKE(z0, z1) → c10(FST(splitAt(z0, z1)), SPLITAT(z0, z1))
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
Defined Rule Symbols:
natsFrom, fst, snd, splitAt, u, head, tail, sel, take, afterNth, activate
Defined Pair Symbols:
SPLITAT, SEL, TAKE, AFTERNTH
Compound Symbols:
c5, c9, c10, c11
(7) CdtPolyRedPairProof (UPPER BOUND (ADD(O(n^1))) transformation)
Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.
SPLITAT(s(z0), cons(z1, z2)) → c5(U(splitAt(z0, activate(z2)), z0, z1, activate(z2)), SPLITAT(z0, activate(z2)), ACTIVATE(z2), ACTIVATE(z2))
We considered the (Usable) Rules:
splitAt(0, z0) → pair(nil, z0)
splitAt(s(z0), cons(z1, z2)) → u(splitAt(z0, activate(z2)), z0, z1, activate(z2))
activate(n__natsFrom(z0)) → natsFrom(z0)
activate(z0) → z0
u(pair(z0, z1), z2, z3, z4) → pair(cons(activate(z3), z0), z1)
natsFrom(z0) → cons(z0, n__natsFrom(s(z0)))
natsFrom(z0) → n__natsFrom(z0)
afterNth(z0, z1) → snd(splitAt(z0, z1))
snd(pair(z0, z1)) → z1
And the Tuples:
SPLITAT(s(z0), cons(z1, z2)) → c5(U(splitAt(z0, activate(z2)), z0, z1, activate(z2)), SPLITAT(z0, activate(z2)), ACTIVATE(z2), ACTIVATE(z2))
SEL(z0, z1) → c9(HEAD(afterNth(z0, z1)), AFTERNTH(z0, z1))
TAKE(z0, z1) → c10(FST(splitAt(z0, z1)), SPLITAT(z0, z1))
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
The order we found is given by the following interpretation:
Polynomial interpretation :
POL(0) = [5]
POL(ACTIVATE(x1)) = 0
POL(AFTERNTH(x1, x2)) = x1 + [2]x2
POL(FST(x1)) = [2]
POL(HEAD(x1)) = [1]
POL(SEL(x1, x2)) = [4] + [2]x1 + [2]x2
POL(SND(x1)) = 0
POL(SPLITAT(x1, x2)) = x1
POL(TAKE(x1, x2)) = [4] + x1
POL(U(x1, x2, x3, x4)) = 0
POL(activate(x1)) = [3]x1
POL(afterNth(x1, x2)) = [5] + [3]x1 + [3]x2
POL(c10(x1, x2)) = x1 + x2
POL(c11(x1, x2)) = x1 + x2
POL(c5(x1, x2, x3, x4)) = x1 + x2 + x3 + x4
POL(c9(x1, x2)) = x1 + x2
POL(cons(x1, x2)) = [4]
POL(n__natsFrom(x1)) = [1]
POL(natsFrom(x1)) = [3] + [3]x1
POL(nil) = [3]
POL(pair(x1, x2)) = [3]
POL(s(x1)) = [2] + x1
POL(snd(x1)) = [3]
POL(splitAt(x1, x2)) = [4] + [2]x1
POL(u(x1, x2, x3, x4)) = [3] + [5]x2 + [2]x3 + [4]x4
(8) Obligation:
Complexity Dependency Tuples Problem
Rules:
natsFrom(z0) → cons(z0, n__natsFrom(s(z0)))
natsFrom(z0) → n__natsFrom(z0)
fst(pair(z0, z1)) → z0
snd(pair(z0, z1)) → z1
splitAt(0, z0) → pair(nil, z0)
splitAt(s(z0), cons(z1, z2)) → u(splitAt(z0, activate(z2)), z0, z1, activate(z2))
u(pair(z0, z1), z2, z3, z4) → pair(cons(activate(z3), z0), z1)
head(cons(z0, z1)) → z0
tail(cons(z0, z1)) → activate(z1)
sel(z0, z1) → head(afterNth(z0, z1))
take(z0, z1) → fst(splitAt(z0, z1))
afterNth(z0, z1) → snd(splitAt(z0, z1))
activate(n__natsFrom(z0)) → natsFrom(z0)
activate(z0) → z0
Tuples:
SPLITAT(s(z0), cons(z1, z2)) → c5(U(splitAt(z0, activate(z2)), z0, z1, activate(z2)), SPLITAT(z0, activate(z2)), ACTIVATE(z2), ACTIVATE(z2))
SEL(z0, z1) → c9(HEAD(afterNth(z0, z1)), AFTERNTH(z0, z1))
TAKE(z0, z1) → c10(FST(splitAt(z0, z1)), SPLITAT(z0, z1))
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
S tuples:none
K tuples:
SEL(z0, z1) → c9(HEAD(afterNth(z0, z1)), AFTERNTH(z0, z1))
TAKE(z0, z1) → c10(FST(splitAt(z0, z1)), SPLITAT(z0, z1))
AFTERNTH(z0, z1) → c11(SND(splitAt(z0, z1)), SPLITAT(z0, z1))
SPLITAT(s(z0), cons(z1, z2)) → c5(U(splitAt(z0, activate(z2)), z0, z1, activate(z2)), SPLITAT(z0, activate(z2)), ACTIVATE(z2), ACTIVATE(z2))
Defined Rule Symbols:
natsFrom, fst, snd, splitAt, u, head, tail, sel, take, afterNth, activate
Defined Pair Symbols:
SPLITAT, SEL, TAKE, AFTERNTH
Compound Symbols:
c5, c9, c10, c11
(9) SIsEmptyProof (EQUIVALENT transformation)
The set S is empty
(10) BOUNDS(O(1), O(1))